package com.livenativern.javascript;
/*
 *  @创建者    lihaijun
 *  @创建时间   2018/5/2 16:06
 *  @描述     ${TODO}
 *
 *  @更新者    $Author
 *  @更新时间   $Date
 *  @更新描述   ${TODO}
 */

import android.text.TextUtils;
import android.webkit.JavascriptInterface;

import com.facebook.react.uimanager.SimpleViewManager;

public class Lateralinterface {

    private SimpleViewManager                          context;
    private Lateralinterface.UpdateUi updateui;
    private Lateralinterface.Loginout loginout;

    public Lateralinterface(SimpleViewManager context) {
        this.context = context;
        updateui= (Lateralinterface.UpdateUi) context;
        loginout= (Lateralinterface.Loginout) context;
    }

    /**
     * 侧滑
     * @param type
     */
    @JavascriptInterface
    public void showToast(String type){
        if(!TextUtils.isEmpty(type)){
            updateui.showOrhide(type);
        }
    }

    public interface UpdateUi{
        void showOrhide(String type);
    }

    /**
     * 退出
     */
    @JavascriptInterface
    public void loginOut(){

        loginout.loginoutact();

    }

    public interface Loginout{
        void loginoutact();
    }
}
